package org.advanced;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @author John.zhang
 * @version Id: NioProcessorHandler, v 1.0 2020/12/14 17:24 ZhiYong Exp $
 */
public class NioProcessorHandler {
    SocketChannel socketChannel;
    Object service;

    public NioProcessorHandler(SocketChannel socketChannel, Object service) {
        this.socketChannel = socketChannel;
        this.service = service;
    }

    public void doProcessor() {
        ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
        try {
            socketChannel.read(byteBuffer);
            int position = byteBuffer.position();
            String s = new String(byteBuffer.array(), 0, position);
            String[] requestData = s.split("@");
            String className = requestData[0];
            //Netty TODO
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
